Skip to content

enhance gc - #320

Merged
JacksonYao287 merged 1 commit into
eBay:mainfrom
JacksonYao287:enhance-gc
Jul 4, 2025
Merged

enhance gc#320
JacksonYao287 merged 1 commit into
eBay:mainfrom
JacksonYao287:enhance-gc

Conversation

@JacksonYao287

@JacksonYao287 JacksonYao287 commented Jun 29, 2025

Copy link
Copy Markdown
Member

1 add task_id for each gc task
2 fix a bug: when fails to create a shard, we need to release the chunk, so that it can be gc

@JacksonYao287
JacksonYao287 requested a review from Besroy June 29, 2025 03:00
@codecov-commenter

codecov-commenter commented Jun 29, 2025

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 35.89744% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.13%. Comparing base (1746bcc) to head (0c76840).
⚠️ Report is 168 commits behind head on main.

Files with missing lines Patch % Lines
src/lib/homestore_backend/gc_manager.cpp 39.13% 22 Missing and 6 partials ⚠️
src/lib/homestore_backend/hs_shard_manager.cpp 36.84% 11 Missing and 1 partial ⚠️
src/lib/homestore_backend/heap_chunk_selector.cpp 14.28% 5 Missing and 1 partial ⚠️
...ib/homestore_backend/replication_state_machine.cpp 20.00% 4 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #320      +/-   ##
==========================================
- Coverage   63.15%   63.13%   -0.03%     
==========================================
  Files          32       35       +3     
  Lines        1900     4001    +2101     
  Branches      204      486     +282     
==========================================
+ Hits         1200     2526    +1326     
- Misses        600     1210     +610     
- Partials      100      265     +165     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

new_shard_id);

if (err == ShardError::NO_SPACE_LEFT) {
gc_manager()->submit_gc_task(task_priority::normal,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this shard doesnt meet gc standard, why we want to GC it?

@JacksonYao287 JacksonYao287 Jul 2, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a case that every chunk has no available space and has garbage, but all of them do not reach the gc threshold. as a result , no chunk can be selected to create shard and no chunk can be gc, and all the create shard will fail. this is case was found in storage hammer gc test.

here , I try to trigger a gc without checking the threshold of the shard to handle this case , so that new create shard can succeed if new available space is freed. this is a best effort gc.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is nothing we can GC, this will be an expensive operation which copies over a chunk for no benefit... But its a minor issue

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can keep it like this for now, and adjust it if necessary in the future

Comment thread src/lib/homestore_backend/hs_blob_manager.cpp Outdated
@JacksonYao287
JacksonYao287 requested a review from xiaoxichen July 3, 2025 09:05
@JacksonYao287
JacksonYao287 force-pushed the enhance-gc branch 2 times, most recently from ed9e4a9 to f8947e2 Compare July 3, 2025 15:08

@xiaoxichen xiaoxichen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add summary to commit message.

Also,

  • Suggest moving GC to a dedicate mod (logdebugmod)
  • Suggest similar pattern like RD_LOG so that task_id can be print more consistent across the code (avoid extra space/capital by mistake).
define GC_LOG(level, task_id, msg, ...)                                                                               \
    LOG##level##MOD(GC, "[task_id={}] " msg, traceID, identify_str(), ##__VA_ARGS__)

}

if (!process_after_gc_metablk_persisted(gc_task_sb, valid_blob_indexes)) {
if (!process_after_gc_metablk_persisted(gc_task_sb, valid_blob_indexes, 0)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do not use magic number 0

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline static atomic_uint64_t _gc_task_id{1}; // 0 is used for crash recoveryf

for the simplicity , 0 is dedicated for crash recovery

1  add task_id for each gc task, which will be helpful to track a
specific gc task
2 we need to release the chunk when fail to create shard, so that it can
be gc
@JacksonYao287
JacksonYao287 merged commit 7535ea9 into eBay:main Jul 4, 2025
25 checks passed
@JacksonYao287
JacksonYao287 deleted the enhance-gc branch July 4, 2025 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants